<div class="page_head">
<h2>Listing companies</h2>
</div>

<table class="data">
  <tr>
   <th><%="URL" %></th>
   <th><%="Company Name".t %></th>
   <th><%="Plan".t %></th>
   <th><%="Users".t %></th>
   <th><%="Projects".t %></th> 
   <th><%="Activities".t %></th> 
   <th><%="Owner".t %></th>
   <th><%="Created At".t %></th>
   <th colspan=3><%="Action".t %></th>
  </tr>
  
<% for company in @companies %>
  <%next if company.parent_id %>

  <tr>
    <td><%=company.url%></td>
    <td><%=link_to company.name,"#",:title =>company.address%></td>
    <td><%=company.plan.name.t%></td>
    <td><%=company.users.size%></td>
    <td><%=company.projects.size%></td>
    <td><%if company.projects.size >0%>M:<%=company.message_size%>,T:<%=company.todo_size%>,W:<%=company.writeboard_size%><%end%></td>
    <td><%=link_to((company.account_owner.name rescue "no user"),"mailto:" + (company.account_owner.email rescue "no email"))%></td>
    <td><%=company.created_at.strftime("%y/%m/%d %H:%M")%></td>
    <td><%= link_to 'Edit', :action => 'edit', :id => company %></td>
    <td><%= link_to image_tag('trash.gif',:border=>0), { :action => 'destroy', :id => company }, :confirm => 'Are you sure?', :post => true %></td>
  </tr>
<% end %>
  <tr><td class=page colspan=8>
<%= link_to '<<', { :page => @company_pages.current.previous } if @company_pages.current.previous %>
<%=pagination_links(@company_pages)%>
<%= link_to '>>', { :page => @company_pages.current.next } if @company_pages.current.next %> 
  </td></tr>
</table>


